翻訳と辞書
Words near each other
・ TPWS
・ TPX
・ TPX2
・ TPZ
・ TPz Fuchs
・ TQ
・ TQ (Haiti)
・ TQ (singer)
・ TQ postcode area
・ TQ-Mi mine
・ Tqibuli Municipality
・ TQM
・ TQMI Ltd
・ TQO
・ TR
Tr (Unix)
・ TR 3
・ TR Araña
・ TR DL class
・ TR Emeritus
・ TR GA class
・ TR GSL class
・ TR MK class
・ TR ML class
・ TR NZ class
・ TR Oil Services
・ TR Pass
・ TR postcode area
・ TR Property Investment Trust
・ TR RV class


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Tr (Unix) : ウィキペディア英語版
Tr (Unix)

tr is a command in Unix-like operating systems. It is an abbreviation of ''translate'' or ''transliterate'', indicating its operation of replacing or removing specific characters in its input data set.
The utility reads a byte stream from its standard input and writes the result to the standard output. As arguments, it takes two sets of characters (generally of the same length), and replaces occurrences of the characters in the first set with the corresponding elements from the second set. For example,
tr 'abcd' 'jkmn'
maps all characters ''a'' to ''j'', ''b'' to ''k'', ''c'' to ''m'', and ''d'' to ''n''.
The character set may be abbreviated by using character ranges. The previous example could be written:
tr 'a-d' 'jkmn'
In POSIX-compliant versions of tr, the set represented by a character range depends on the locale's collating order, so it is safer to avoid character ranges in scripts that might be executed in a locale different from that in which they were written. Ranges can often be replaced with POSIX character sets such as ''()''.
The ''s'' flag causes tr to compress sequences of identical adjacent characters in its output to a single token. For example,
tr -s '\n'
replaces sequences of one or more newline characters with a single newline.
The ''d'' flag causes tr to delete all tokens of the specified set of characters from its input. In this case, only a single character set argument is used. The following command removes carriage return characters.
tr -d '\r'
The ''c'' flag indicates the complement of the first set of characters. The invocation
tr -cd '()'
therefore removes all non-alphanumeric characters.
Most versions of tr, including GNU tr and classic Unix tr, operate on single-byte characters and are not Unicode compliant. An exception is the Heirloom Toolchest implementation, which provides basic Unicode support.
Ruby and Perl also have an internal ''tr'' operator, which operates analogously. Tcl's ''string map'' command is more general in that it maps strings to strings while tr maps characters to characters.〔(【引用サイトリンク】url=https://www.tcl.tk/man/tcl8.4/TclCmd/string.htm#M33 )
==See also==

*Sed
*List of Unix programs
*GNU Core Utilities

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Tr (Unix)」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.